<?php

namespace app\store\validate;

use think\Validate;

class TaskValidate extends Validate
{
    protected $rule = [
        'task_type' => 'in:1,2,3,4,5',
        'user_combo_id' => 'requireWith|integer',
        'group_activity_id' => 'requireWith|integer',
        'join_num' => 'requireWith|integer|>:0|<:255',
        'expire_type' => 'require|in:1,2',
        'expire_time' => 'requireWith|integer|>:0|<:255',
        'start_time' => 'requireWith|dateFormat:Y-m-d H:i:s',
        'end_time' => 'requireWith|dateFormat:Y-m-d H:i:s',
    ];

    protected $message = [
        'id.require' => '非法请求!',
        'task_type.in' => '选择的任务类型不合法!',
        'invite_num.requireWith' => '参与次数不能为空!',
        'user_combo_id.requireWith' => '请选择会员套餐!',
        'group_activity_id.requireWith' => '请选择会员套餐!',
    ];

    public function sceneEdit()
    {
        return $this->only(['task_type','user_combo_id','group_activity_id','join_num','expire_type','expire_time','start_time','end_time'])->append('id','require|integer');
    }
}